export default {
    name: "Mydevice",
    components: {},
    data() {
        return {
            currentTab: '/alldevicelist',
            showPage: '/alldevicelist',
            ShowTabs: true,
            tabList: [
                {
                    action: '/alldevicelist',
                    name: '报表模式'
                },
                {
                    action: '/alldevicemap',
                    name: '地图模式'
                },
                {
                    action: '/alldevicepreview',
                    name: '视图模式'
                }
            ]
        };
    },
    computed: {},
    watch: {
        currentTab(newVal, oldVal) {
            this.$router.push({
                path: newVal
            });
        },
        $route: {
            handler(val, oldVal) {
                if (val.path == '/alldevice') {
                    this.routeAgain();
                } else if (val.path == '/deviceset') {
                    this.ShowTabs = false;
                } else if (val.path == '/alldevicelist') {
                    this.ShowTabs = true;
                    this.currentTab = this.showPage;
                } else if (val.path == "/devicedetail") {
                    this.ShowTabs = false;
                } 
            }
        }
    },
    created() {
        this.routeAgain();
        this.$router.push({
            path: this.showPage,
        });
    },
    mounted() { },
    methods: {
        routeAgain() {
            this.$router.push({
                path: '/alldevicelist'
            })
        }
    }
};